package com.yf.config;

import com.yf.entity.UserEntity;
import com.yf.resolver.LoginUserResolver;
import com.yf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import java.util.List;


@Configuration
@EnableWebMvc
@ComponentScan( basePackages = {"com.yf.*"})
public class MyMvcConfig extends MvcConfig{

    @Autowired
    private UserService userService;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
       resolvers.add(new LoginUserResolver(UserEntity.class,userService));
    }
}
